package com.school.manager.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.school.manager.domaim.TecTask;
import com.school.manager.entity.po.TecTaskPo;
import com.school.manager.entity.po.UserTaskPo;
import com.school.manager.entity.vo.TecTaskVo;
import com.school.manager.entity.vo.UserTaskVo;
import com.school.manager.mapper.TecTaskMapper;
import com.school.manager.service.ITecTaskService;
import com.school.manager.utils.PageUtil;

import lombok.extern.slf4j.Slf4j;

/**
 * description：教师教学任务业务实现类
 * date：2021/10/133:18 下午
 */

@Service
@Slf4j
public class TecTaskServiceImpl extends ServiceImpl<TecTaskMapper, TecTask> implements ITecTaskService {
	
	@Autowired
    private TecTaskMapper tecTaskMapper;
	
	@Override
	public Page<TecTaskVo> page(TecTaskPo tecTaskPo) {
		QueryWrapper<TecTask> queryWrapper = PageUtil.buildQueryWrapper(tecTaskPo, TecTask.class);
        Page<TecTask> page = new Page<>(tecTaskPo.getCurrent(), tecTaskPo.getSize());
        tecTaskMapper.selectPage(page, queryWrapper);
        return PageUtil.buildPage(page, TecTaskVo.class);
	}

	@Override
	public Page<TecTaskVo> myPage(TecTaskPo tecTaskPo) {
		Page<TecTaskVo> page = new Page<>(tecTaskPo.getCurrent(), tecTaskPo.getSize());
		List<TecTaskVo> records = tecTaskMapper.myPage(page, tecTaskPo);
		page.setRecords(records);
		return page;
	}

	@Override
	public Page<UserTaskVo> userPage(UserTaskPo tecTaskPo) {
		Page<UserTaskVo> page = new Page<>(tecTaskPo.getCurrent(), tecTaskPo.getSize());
		List<UserTaskVo> records = tecTaskMapper.userPage(page, tecTaskPo);
		page.setRecords(records);
		return page;
	}
	

}
